package com.bgy.config.jwt;

import java.util.List;
import java.util.stream.Collectors;

import com.bgy.config.jwt.bean.Teanant;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

public final class JwtUserFactory {

    public static JwtUser create(Teanant teanant) {
        return new JwtUser(teanant.getId(),teanant.getPassword(),teanant.getUsername(),teanant.getTenant(),teanant.getVersion(),teanant,teanant.getUrl());
    }

    private static List<GrantedAuthority> mapToGrantedAuthorities(List<String> authorities) {

        return authorities.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList());
    }

}
